{include file="common/head"/}
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>
    {include file="common/left"}
    <div class="main-content">
        <div class="main-content-inner">
            {include file="common/header_nav"}

            <div class="page-content">
                <div class="page-header">
                    <h1>
                        您当前操作
                        <small>
                            <i class="ace-icon fa fa-angle-double-right"></i>
                            修改导航信息
                        </small>
                    </h1>
                </div><!-- /.page-header -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form class="form-horizontal" role="form" name="ruleUpdate" id="ruleUpdate" method="post" action="{:url('ruleUpdate')}">
                            <input type="hidden" name="id" value="{$rule.id}"/>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="title">导航标题</label>
                                <div class="col-sm-10 col-xs-12">
                                    <input type="text" name="title" id="title" value="{$rule.title}" placeholder="导航标题" class="col-xs-12 col-md-4"/>
                                    <span class="help-inline">
                                        <span class="middle" id="resone"></span>
                                    </span>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="name">控制器/方法</label>
                                <div class="col-sm-10 col-xs-12">
                                    <input type="text" name="name" id="name" value="{$rule.name}" placeholder="控制器/方法" class="col-xs-12 col-md-4"/>
                                     <span class="help-inline">
                                        <span class="middle" id="restwo"></span>
                                    </span>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="css">样式名称：</label>
                                <div class="col-sm-10 col-xs-12">
                                    <input type="text" name="css" id="css" value="{$rule.css}" placeholder="样式名称" class="col-xs-12 col-md-4"/>
                                    <span class="help-inline">
                                        <span class="middle">只针对顶级栏目有效</span>
                                    </span>
                                </div>
                                <span class="col-xs-12 col-sm-2 col-md-2"></span>
                                <span class="col-xs-12 col-sm-10 col-md-10" style="font-size:12px; color:#999; margin-top:5px;">预留样式：fa-tachometer ， fa-folder ， fa-list ， fa-list-alt ， fa-calendar</span>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="status"> 是否开启： </label>
                                <div class="col-sm-10 col-xs-12" style="padding-top:5px;">
                                    <label>
                                        <input name="status" id="status" value="1" {if condition="$rule['menustatus'] eq 1"}checked{/if} class="ace ace-switch ace-switch-5" type="checkbox">
                                        <span class="lbl">&nbsp;&nbsp;默认关闭</span>
                                    </label>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="sort">排序（从小到大）：</label>
                                <div class="col-sm-10 col-xs-12">
                                    <input type="text" name="sort" id="sort" value="{$rule.sort}" placeholder="排序（从小到大）" class="col-xs-12 col-md-4"/>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="clearfix form-actions">
                                <div class="col-md-offset-2 col-md-10">
                                    <button class="btn btn-info" type="submit">
                                        <i class="ace-icon fa fa-check bigger-110"></i>
                                        提交
                                    </button>

                                    &nbsp; &nbsp; &nbsp;
                                    <button class="btn" type="reset">
                                        <i class="ace-icon fa fa-undo bigger-110"></i>
                                        重置
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    {include file="common/foot" /}
</div>
<script>
    $(function () {
        $('#ruleUpdate').ajaxForm({
            beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
            success: complete, // 这是提交后的方法
            dataType: 'json'
        });

        function checkForm() {
            if ('' == $.trim($('#title').val())) {
                layer.alert('导航标题不能为空', {icon: 5}, function (index) {
                    layer.close(index);
                    $('#title').focus();
                });
                return false;
            }

            if ('' == $.trim($('#name').val())) {
                layer.alert('控制器/方法不能为空', {icon: 5}, function (index) {
                    layer.close(index);
                    $('#name').focus();
                });
                return false;
            }
        }
        function complete(data) {
            if (data.status == 1) {
                layer.alert(data.info, {icon: 6}, function (index) {
                    layer.close(index);
                    window.location.href = data.url;
                });
            } else {
                alert(data.info);
                return false;
            }
        }
    });

</script>
</body>
</html>